<?php
class Colegiado{

	private $id;
	private $nome;
	private $email;
	private $qtdProf;
	
	public function __construct($id = 0,$nome= "" ,$email= "" ,$qtdProf= 0){
		$this->id = $id;
		$this->nome = $nome;
		$this->email = $email;
		$this->qtdProf = $qtdProf;
	}

	public static function construct($array){
		return new Colegiado( $array['id'], $array['nome'], $array['email'], $array['qtdProf']);
	}

	public function getId(){
		return $this->id;
	}

	public function setId($id=0){
		$this->id=$id;
	}

	public function getNome(){
		return $this->nome;
	}

	public function setNome($nome){
		$this->nome=$nome;
	}

	public function getEmail(){
		return $this->email;
	}

	public function setEmail($email){
		$this->email=$email;
	}
	
	public function getQtdProf(){
		return $this->qtdProf;
	}
	
	public function setQtdProf($qtdProf=0){
		$this->qtdProf=$qtdProf;
	}
	
	public function equals($object){
		if($object instanceof Colegiado){
			if($this->id!=$object->id){
				return false;
			}
			if($this->nome!=$object->nome){
				return false;
			}
			if($this->email!=$object->email){
				return false;
			}
			if($this->qtdProf!=$object->qtdProf){
				return false;
			}
			return true;
		}
		else{
			return false;
		}
	}
	
	public function toString(){
		return "  [id:" .$this->id. "]  [nome:" .$this->nome. "]  [email:" .$this->email. "]  [qtdProf:" .$this->qtdProf."]" ;
	}
	
	public function toArray(){
		$temp =   (array) $this;
		$array = array();

		foreach ($temp as $k => $v){
			$k = preg_match('/^\x00(?:.*?)\x00(.+)/', $k, $matches) ? $matches[1] : $k;
			$array[$k] = $v;
		}
		return  $array;
	}
}

?>